Back to Projects

Recursive Ray Tracer (C++)

Project: High-Performance Renderer Architecture and Core Ray Tracing Loop

C++ Graphics Ray Tracing Scene Graph Architecture

This project involved creating the foundational architecture for a recursive ray tracing renderer in C++. The core accomplishment was implementing a decoupled rendering pipeline by using an abstract renderer base class and a custom Scene Graph. This allowed the system to switch seamlessly between a fast OpenGL rendering preview and the custom Ray Tracing calculation kernel.

The technical focus was on calculating the correct camera rays, managing polygon transformations from local to world space, and integrating with a specialized intersection engine to find the nearest hit point, forming the basis for lighting, shadows, and reflections.

Renderer Architecture & System Design

I designed the renderer around a strict separation between scene representation and rendering execution. Geometry, materials, and transformations were defined independently of the rendering method, allowing the same scene to be rendered through different pipelines without modification.

This architectural choice reduced coupling, simplified debugging, and ensured the system could scale beyond a single rendering technique. It also enabled rapid iteration on the ray tracing logic without destabilizing scene construction.

Hierarchical Transformations & World-Space Accuracy

All objects were organized hierarchically, allowing transformations to propagate naturally through the scene. Translation and rotation logic was handled centrally to guarantee consistency across complex object groupings.

A transformation stack accumulated these changes and applied the final composite transform to every vertex and normal before intersection testing. This ensured that visual placement and geometric calculations remained perfectly aligned in world space.

Ray Construction & Camera Mathematics

The core rendering loop was built from first principles. Each pixel was mapped to a ray originating at the camera and passing through a mathematically defined projection plane based on field of view and aspect ratio.

  1. Convert pixel coordinates into normalized projection-plane space.
  2. Construct and normalize the corresponding world-space ray direction.
  3. Query the intersection system to identify the nearest surface hit.
  4. Assign pixel color based on material data or background state.

This approach emphasized correctness and predictability, forming a reliable base for future lighting and recursion.

Incremental Validation Strategy

Rather than introducing lighting complexity early, I validated the pipeline using minimal shading. This allowed me to isolate issues in ray construction, transformation accuracy, and intersection logic without visual noise.

Once correctness was established, the system was prepared to support shadows, reflections, and recursive ray evaluation without architectural changes.

Outcome & Technical Impact

The final result is a clean, extensible ray tracing foundation with clearly defined responsibilities and mathematically consistent behavior. The architecture supports future feature expansion while maintaining correctness and maintainability.

This project demonstrates a problem-solving mindset focused on decomposition, validation of fundamentals, and designing systems that scale in complexity without sacrificing clarity.